<?php

/**
 * StringManipulation provides several util methods to manipulate strings
 * 
 * @author Maximilian Lenkeit <dev@lenki.com>
 *
 */
class StringManipulation
{

  /**
   * Sluggify a string (make it e.g. usable for urls)
   * 
   * @author Maximilian Lenkeit <dev@lenki.com>
   * 
   * @param  string $text
   * @return string
   */
  public static function sluggify ($text)
  {
    // replace all non letters or digits by -
    $text = preg_replace('/\W+/', '-', $text);
    
    // trim and lowercase
    $text = strtolower(trim($text, '-'));
    
    return $text;
  }
}

?>